﻿<%@ Page Title="会议安排" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="MeetingArrange.aspx.cs" Inherits="Howork.MeetingArrange" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript" src="Scripts/WdatePicker.js"></script>
    <script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script>
    <script type="text/javascript" src="Scripts/meeting.js"></script>
    <style type="text/css">
        input.book_button
        {
            background-color:#3DBEC9;
            width:50px;
            }
        tr.table_head
        {
            background-color:#C6AFF3;
            height:50px;
          }
        table.room_table
        {
            width:300px;
            margin-left:100px;
            margin-top:10px;
            }
        
    </style>
    <script type="text/javascript">
        $("document").ready(function () {
            $("#query_room").mouseup(function () {
                $("loading_img").show();
                var begin_time = $("#text_begin").val();
                var end_time = $("#text_end").val();
                if (begin_time == "")
                    alert("请选择开始时间");
                else if (end_time == "")
                    alert("请选择结束时间");
                else {
                    $.ajax({
                        url: "QueryRoom.aspx",
                        type: "post",
                        dataType: "json",
                        data: { begin: begin_time, end: end_time },
                        success: function (msg) {
                            $("loading_img").hide();
                            $("table tr:gt(0)").remove();
                            $(msg).each(function () {
                                var id = this.id;
                                var button = "<input type='button' class='book_button' id=" + id + " value='预订'></input>";
                                var row = "<tr id=" + id + "><td align='center'>" + this.id + "</td><td align='center'>" + this.capacity + "</td><td align=center>" + button + "</td></tr>";
                                var row_num = $("table tr").size() - 1;
                                $(row).insertAfter($("table tr:eq(0)"));
                            })
                            $("input[type='button']").mouseup(function () {
                                var id = $(this).attr("id");
                                $.ajax({
                                    url: "BookRoom.aspx",
                                    type: "post",
                                    data: { id: id, begin: begin_time, end: end_time },
                                    success: function (msg) {
                                        alert(msg);
                                        $("tr#" + id + "").remove();
                                    }
                                })
                            })
                        }
                    });
                }
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <label>开始时间</label>
    <input id="text_begin" type="text" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"></input>
    <label>结束时间</label>
    <input id="text_end" type="text" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"></input>
    <input id="query_room" type="button" style="{background-color:White}" value="查询"></input>
    <div style="margin-top: 10px">
    <label>房间列表：</label>
    <table class="room_table" title="房间列表">
        <tr class="table_head">
        <th style="{width:100px}">房间号</th>
        <th style="{width:100px}">房间容量</th>
        <th style="{width:100px}">预订</th>
        </tr>
    </table>
    </div>
</asp:Content>
